const { defineConfig } = require('@vue/cli-service')
const Mock=require("mockjs")
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave:false,

  devServer: {
    onAfterSetupMiddleware: function (devServer) {
      if (!devServer) {
        throw new Error('webpack-dev-server is not defined');
      }

      devServer.app.get('/list', function (req, res) {
        let data=Mock.mock({
          "data|10":[{
            id:"@id",
            img:"@image(100x100,@color)",
            title:"@ctitle(2,5)",
            "price|10-200":0,
          }]
        })

        res.json(data.data);
      });
    },
  }
})
